<?php
class AOrdenDespachoPartesManual
{
	public function __construct() {}
	public function marcaPartes(EFacade & $facade) 
	{
		$m = epManager::instance();
				
		//Disparo el agente en t3 de la ODP
		$workflowODP = & $facade->getWorkflow();
		$transSetODP = & EFacade :: getCurrentTransSetAuto($workflowODP, 2); //TYPE AUTO AGENT
		$role=NULL;
		$transODP = $transSetODP->getTransByName('t3');
		$facade->fireTrans($transODP,$role,'Marcar Partes', TRUE);
	}
	public function culminarDespacho(EFacade & $facade) 
	{
		$m = epManager::instance();
		$ODP = & $facade->getDocumentRoot();
		$SPA = & $ODP->solicitud; 	
		//Disparar la T4 de la SPM para que finalice
		$workflow = & $SPA->getWorkflowRef();
		$facade->session->refresh($workflow);
		$newEfacade = & EFacade :: initWorkflowWithoutRole($facade->session, $SPA, 3);//tipo Process
		$transSet = & EFacade :: getCurrentTransSetAuto($workflow, /*PROCESS */ 3);
		$trans = $transSet->getTransByName('t4');
		$role = null;
		$newEfacade->fireTrans($trans, $role, "Culmina",TRUE);
		$workflow->epSetDirty(TRUE);
		$SPA->epSetDirty(TRUE);
		$newEfacade->saveWorkflow();
				
		//Disparo el agente en t3 de la ODP
		$workflowODP = & $facade->getWorkflow();
		$transSetODP = & EFacade :: getCurrentTransSetAuto($workflowODP, 2); //TYPE AUTO AGENT
		$role=NULL;
		$transODP = $transSetODP->getTransByName('t6');
		$facade->fireTrans($transODP,$role,'Marcar Partes', TRUE);
	}	
}
?>